package com.xjc.controller.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * flowable模型任务节点({@code <userTask>})自定义变量标签({@code <extensionElements>}),
 * 如下，解析出来就会有四个本类型对象，一个initiator-can-complete，一个field，两个customProperty：
 * <pre>{@code
 * <userTask id="propertyManager" name="产权管理方审核" flowable:assignee="${propertyManager}" flowable:formFieldValidation="true">
 *  <extensionElements>
 *      <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
 *      <flowable:field name="taskPara" stringValue="产权管理方审核..." />
 *      <flowable:customProperty name="isAllowDynamic" value="false">ok</flowable:customProperty>
 *      <flowable:customProperty name="isAllowSendMsg" value="true" />
 *  </extensionElements>
 * </userTask>
 * }</pre>
 * 解析出来的数据结构如下：
 * <pre>{@code
 * [
 *  {
 *    "elementName": "initiator-can-complete",
 *    "elementText": "",
 *    {}
 *  },
 *  {
 *    "elementName": "field",
 *    "elementText": null,
 *     {
 *       "name": ["taskPara"],
 *       "stringValue": ["项目租赁负责人1..."]
 *     }
 *  },
 *  {
 *    "elementName": "customProperty",
 *    "elementText": "ok",
 *      {
 *          "name": ["isAllowDynamic"],
 *          "value": ["true"]
 *      }
 *  },
 *  {
 *      "elementName": "customProperty",
 *      "elementText": null,
 *      {
 *          "name": ["isAllowSendMsg"],
 *          "value": ["false"]
 *      }
 *   }
 * ]
 * }</pre>
 * </p>
 *
 * @author xiaojincai
 * @since 2025-07-11
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "ExtensionElementVO")
public class ExtensionElementVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 元素名称
     */
    @Schema(description = "元素名称")
    private String elementName;

    /**
     * 元素文本值
     */
    @Schema(description = "元素文本值")
    private String elementText;

    /**
     * 每个标签对象存放格式如下：
     * 属性名称-属性值，属性值是一个列表
     */
    @Schema(description = "属性名称-属性值，属性值是一个列表")
    private Map<String, List<String>> attributes;

    /**
     * 子标签列表
     */
    @Schema(description = "子标签列表")
    private List<ExtensionElementVO> childElements;
}